/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cn.cheln.explorer.cpnt.adapter;

import android.content.Context;
import android.database.Cursor;

import java.util.List;
import java.util.Map;

import cn.cheln.explorer.beans.FileInfo;
import cn.cheln.explorer.ds.database.DatasrcTransferer;
import cn.cheln.support.ui.adapter.ItemDataSrc;

/**
 *
 * @author chenliang
 */
public class CursorItemSrc extends ItemDataSrc {

    private Class<? extends FileInfo> targetclazz;
    private Context context;
//    public TextIndexer textIndexer;
    private String indexedColumnName;
	private int currindex;
	private int negativeCount;

    public CursorItemSrc() {
    }

    public CursorItemSrc(List list) {
        super(list);
    }

    public CursorItemSrc(Context context, Cursor cursor, Map<String, Class> nameTypePair, Class<? extends FileInfo> targetclazz) {
        this(context, cursor, nameTypePair, targetclazz, "");
    }

    public CursorItemSrc(Context context, Cursor cursor, Map<String, Class> nameTypePair, Class<? extends FileInfo> targetclazz, String indexedColumnName) {
        super(cursor, nameTypePair);
        this.targetclazz = targetclazz;
        this.context = context;
        this.indexedColumnName = indexedColumnName;
    }
    public CursorItemSrc(Context context, Map<String, Class> nameTypePair, Class<? extends FileInfo> targetclazz, String indexedColumnName) {
        super( nameTypePair);
        this.targetclazz = targetclazz;
        this.context = context;
        this.indexedColumnName = indexedColumnName;
    }
    public Cursor getContentCursor() {
        return mCurrentCursor;
    }

    @Override
    public Object getItem(int position) {
        
        Object src = super.getItem(position);
        return src instanceof Cursor ? DatasrcTransferer.mediaTransf(context, (Cursor) src, targetclazz) : src;
    }

}
